home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 353_02 / transprt.cpp < prev    next >
C/C++ Source or Header  |  1992-01-18  |  944b  |  33 lines

  1.                                   // Chapter 7 - Program 3
  2. #include <iostream.h>
  3. #include "vehicle.h"
  4.  
  5. main()
  6. {
  7. vehicle car, motorcycle, truck, sedan;
  8.  
  9.    car.initialize(4, 3000.0);
  10.    motorcycle.initialize(2, 900.0);
  11.    truck.initialize(18, 45000.0);
  12.    sedan.initialize(4, 3000.0);
  13.    
  14.    cout << "The car has " << car.get_wheels() << " wheels.\n";
  15.    cout << "The truck has a loading of " << truck.wheel_loading()
  16.                   << " pounds per wheel.\n";
  17.    cout << "The motorcycle weighs " << motorcycle.get_weight() 
  18.                   << " pounds.\n";
  19.    cout << "The sedan weighs " << sedan.get_weight() 
  20.                   << " pounds, and has " << sedan.get_wheels() 
  21.                   << " wheels.\n";
  22. }
  23.  
  24.  
  25.  
  26.  
  27. // Result of execution
  28. //
  29. // The car has 4 wheels.
  30. // The truck has a loading of 2500 pounds per wheel.
  31. // The motorcycle weighs 900 pounds.
  32. // The sedan weighs 3000 pounds, and has 4 wheels.
  33.